package ro.isdc.vms.vehicleadvertisement.batch.processors;

import org.springframework.batch.item.ItemProcessor;

import ro.isdc.vms.utils.timestamp.TimeStampUtil;
import ro.isdc.vms.vehicleadvertisement.domain.VehicleAdvertisement;

/**
 * Item Processor for flagging old advertisements.
 * 
 * @author Andrei Chirila
 */
public class FlagOldAdvertisementsItemProcessor implements ItemProcessor<VehicleAdvertisement, VehicleAdvertisement> {

  /**
   * {@inheritDoc}
   */
	public VehicleAdvertisement process(final VehicleAdvertisement vehicleAdvertisement)
			throws Exception {
		vehicleAdvertisement.setDeletionTimestamp(TimeStampUtil.getTimeStamp());
		vehicleAdvertisement.setFlaggedAsOld(true);
		return vehicleAdvertisement;
	}

}
